package com.serkol.ams.controller.api;

import com.serkol.ams.bean.Result;
import com.serkol.ams.entity.About;
import com.serkol.ams.service.AboutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("api/about")
public class AboutController {
    @Autowired
    private AboutService aboutService;

    @GetMapping("/info")
    public Result info() {
        Map<String, Object> map = aboutService.getInfo();
        return Result.ok(map);
    }
    @PostMapping("/edit")
    public Result edit(@RequestBody About about) {
        about.setId(1L);
        boolean b = aboutService.saveOrUpdate(about);
        return b?Result.ok():Result.failure();
    }
}
